package com.cn.util;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;

/**
 * @program: demo
 * @description:把文件转成base64编码
 * @author: yihanyuan
 * @create: 2019-07-03 13:43
 */
public class FileTransBase64 {
    @Test
    public void te() throws IOException {
        InputStream inputStream = new FileInputStream("C:\\Users\\yihanyuan\\Desktop\\111.png");
        byte[] date = new byte[inputStream.available()];
        inputStream.read(date);
        inputStream.close();
        System.out.println(Base64.getEncoder().encodeToString(date));
    }

    @Test
    public void hash() {
        System.out.println("1111111".hashCode());
    }
}
